package com.aruba.daggerapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.aruba.daggerapplication.di.DaggerApplicationComponent
import com.aruba.daggerapplication.di.datasource.DataSource
import com.aruba.daggerapplication.di.singleton.SingletonTest
import com.aruba.daggerapplication.di.subobj.SubObject
import javax.inject.Inject

class SubActivity : AppCompatActivity() {

    @Inject
    lateinit var singleton: SingletonTest

    @Inject
    lateinit var subObject1: SubObject

    @Inject
    lateinit var subObject2: SubObject

    override fun onCreate(savedInstanceState: Bundle?) {
        Component.daggerApplicationComponent.subComponent().create().inject(this)
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_sub)

        Log.i("aruba_log", "SubActivity singleton hashcode: ${singleton.hashCode()}")
        Log.i("aruba_log", "SubActivity subObject1 hashcode: ${subObject1.hashCode()}")
        Log.i("aruba_log", "SubActivity subObject2 hashcode: ${subObject2.hashCode()}")
    }
}